package com.luweijie.sh.mapper;

import com.luweijie.sh.entity.po.Resource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 资源表 Mapper 接口
 * </p>
 *
 * @author luweijie
 * @since 2020-06-11
 */
@Mapper
public interface ResourceMapper extends BaseMapper<Resource> {
  @Select("select re.url,re.method\n" +
          "from roles r,role_resource_relation rm,resource re " +
          "where r.type=#{role} and r.id=rm.role_id and rm.resource_id=re.id")
    public List<Resource> query(@Param("role") String role);
}
